<!DOCTYPE html>
<html>
<head>
    <title>图书列表</title>
</head>
<body>
    <h1>图书列表</h1>
    <ul>
        {% for book in books %}
        <li>
            <a href="{% url 'book_detail' book.pk %}">{{ book.title }}</a>
            - {{ book.authors.all|join:", " }}
            {% if book.is_in_stock %}
                (有货)
            {% else %}
                (缺货)
            {% endif %}
        </li>
        {% endfor %}
    </ul>
</body>
</html>